{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">

                    <div class="layui-form-item">
                        <label class="layui-form-label">站点标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="site_title" value="{$info.site_title|default=''}" jq-verify="" jq-error=" 请输入站点标题" placeholder="请输入站点标题" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">站点关键词</label>
                        <div class="layui-input-block">
                            <input type="text" name="site_keywords" value="{$info.site_keywords|default=''}" jq-verify="" jq-error=" 请输入站点关键词" placeholder="请输入站点标题" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">站点描述</label>
                        <div class="layui-input-block">
                            <textarea name="site_description" placeholder="请输入站点描述" class="layui-textarea">{$info.site_description|default=''}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">站点网址</label>
                        <div class="layui-input-block">
                            <input type="text" name="site_url" value="{$info.site_url|default=''}" jq-verify="" jq-error=" 请输入站点网址" placeholder="请输入站点标题" class="layui-input ">
                        </div>
                    </div>
					
					<style>
						.add_rule,.del_rule{ padding:5px 20px; background:#009688; color:#fff; display:inline-block; margin-left:20px; }
						.add_rule:hover,.del_rule:hover{ color:#fff }
					</style>
					
					<div class="layui-form-item">
                        <label class="layui-form-label">爽约规则</label>
                        <div class="layui-input-block">
							<table style=" margin-left:20px;width:632px;">
								<tr>
									<td colspan="5" height="50"><a href="javascript:;" class="add_rule" style="float:right;" title="新增规则">新增规则</a></td>
								</tr>
								<tbody class="rule_list">
									{if $info['rule_data']}
									{foreach name="info.rule_data" item="vo" key="key"}
									<tr>
										<td width="80" height="50">爽约次数：</td>
										<td><input class="layui-input" value="{$vo.num}" name="rule_data[{$key}][num]" type="text" /></td>
										<td width="100">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;限制天数：</td>
										<td><input class="layui-input" value="{$vo.day}" type="text" name="rule_data[{$key}][day]" /></td>
										<td><a href="javascript:;" class="del_rule" onclick="rule_del(this)" title="删除规则">删除</a></td>
									</tr>
									{/foreach}
									{/if}
								</tbody>
							</table>
                        </div>
                    </div>

                    <div class="layui-input-block">
                        <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script src="/static/home/js/jquery-1.9.1.min.js"></script>
<script id="templist">
	<tr>
		<td width="80" height="50">爽约次数：</td>
		<td><input class="layui-input" name="rule_data[{#index}][num]" type="text" /></td>
		<td width="100">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;限制天数：</td>
		<td><input class="layui-input" type="text" name="rule_data[{#index}][day]" /></td>
		<td><a href="javascript:;" class="del_rule" onclick="rule_del(this)" title="删除规则">删除</a></td>
	</tr>
</script>
<script>
    layui.use('pageform');
	$(".add_rule").click(function(){
		var rnd="";
		for(var i=0;i<5;i++) {
			rnd+=Math.floor(Math.random()*10);
		}
		
		$(".rule_list").append( $("#templist").html().replace("{#index}" , rnd).replace("{#index}" , rnd) );
	});
	function rule_del(obj) {
		$(obj).closest("tr").remove();
	}
</script>
{/block}